package com.cloud.tsp.config;

import lombok.Data;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.AdminClientConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

@Data
@Configuration
public class KafkaConfig {
    @Value("${kafka.url}")
    private String kafkaUrl;
    @Bean
    public AdminClient adminClient() {
        Properties properties = new Properties();
        properties.setProperty(AdminClientConfig.
                BOOTSTRAP_SERVERS_CONFIG, kafkaUrl);
        return AdminClient.create(properties);
    }
}